//
//  DTLongButtonView.m
//  DatangLife
//
//  Created by 陈建 on 2018/5/25.
//  Copyright © 2018年 DatangLife. All rights reserved.
//

#import "DTLongButtonView.h"

@implementation DTLongButtonView

+ (instancetype)shareView{
    // kStatusBarHeight + 10 + 20 + 10 + 30
    DTLongButtonView *navBarView = [[DTLongButtonView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 80)];
    
    return navBarView;
}


- (void)layoutSubviews{
    [super layoutSubviews];
    UIView *spaceView1 = [[UIView alloc] init];
    spaceView1.backgroundColor = [UIColor whiteColor];
    [self addSubview:spaceView1];
    [spaceView1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.equalTo(self);
        make.height.equalTo(@20);
    }];
    UIView *spaceView2 = [[UIView alloc] init];
    spaceView2.backgroundColor = [UIColor whiteColor];
    [self addSubview:spaceView2];
    [spaceView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self);
        make.left.right.equalTo(self);
        make.height.equalTo(@20);
    }];
    [self.tapBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(spaceView2.mas_top);
        make.left.equalTo(self).offset(25);
        make.right.equalTo(self).offset(-25);
        make.height.equalTo(@40);
    }];
    
}

- (UIButton *)tapBtn{
    if (!_tapBtn) {
        _tapBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        _tapBtn.backgroundColor = kCommonRedColor;
        [_tapBtn setTitleColor:kWhiteColor forState:UIControlStateNormal];
        _tapBtn.titleLabel.font = kFont(15.f);
        _tapBtn.layerCornerRadius = 20;
        [_tapBtn addTarget:self action:@selector(tapbtnClick) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:_tapBtn];
    }
    return _tapBtn;
}

- (void)tapbtnClick{
    self.tapBtnBlock();
}

@end
